<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="../resources/common.js"></script>
</head>
<body>

<select id="select1" size=3>
<option selected>a</option>
<option style="display: none">b</option>
<option>c</option>
<option>d</option>
</select>

<select id="select2" size=3>
<option selected>a</option>
<option id="select2-b">b</option>
<option>c</option>
<option>d</option>
</select>

<select id="select3" size=3>
<option selected>a</option>
<option id='select3-b' style="display: none">b</option>
<option>c</option>
<option>d</option>
</select>

<select id="select4" size=3>
<option selected>a</option>
<option>b</option>
<optgroup label="**cd**">
    <option style="display: none">c</option>
    <option>d</option>
</optgroup>
</select>

<select id="select5" size=3>
<option selected>a</option>
<option>b</option>
<optgroup label="**cd**" style="display: none">
    <option>c</option>
    <option>d</option>
</optgroup>
<option>e</option>
</select>

<script>
document.getElementById('select2-b').style.display = 'none';
document.getElementById('select3-b').style.display = 'block';

description('Tests for select not showing option element with display: none');

var select1 = document.getElementById('select1');
select1.focus();
shouldBeEqualToString('select1.value', 'a');
eventSender.keyDown('ArrowDown');
shouldBeEqualToString('select1.value', 'c');

var select2 = document.getElementById('select2');
select2.focus();
shouldBeEqualToString('select2.value', 'a');
eventSender.keyDown('ArrowDown');
shouldBeEqualToString('select2.value', 'c');

var select3 = document.getElementById('select3');
select3.focus();
shouldBeEqualToString('select3.value', 'a');
eventSender.keyDown('ArrowDown');
shouldBeEqualToString('select3.value', 'b');

var select4 = document.getElementById('select4');
select4.focus();
shouldBeEqualToString('select4.value', 'a');
eventSender.keyDown('ArrowDown');
eventSender.keyDown('ArrowDown');
shouldBeEqualToString('select4.value', 'd');

var select5 = document.getElementById('select5');
select5.focus();
shouldBeEqualToString('select5.value', 'a');
eventSender.keyDown('ArrowDown');
eventSender.keyDown('ArrowDown');
shouldBeEqualToString('select5.value', 'e');

</script>

</body>
</html>
